<?php

namespace App\Model;

use Illuminate\Database\Eloquent\Model;

class Knowledges extends Model
{
    //
    protected $table = 'knowledges';

    public $timestamps = false;

    protected $fillable = ['title','author','centent','create_time','type','status'];
    public function getCreatAtAttribute()
    {
        return date('Y-m-d', strtotime($this->attributes['creat_at']));
    }
    static function getData($type,$page=1){
        return self::where([['status','=','1'],['type', '=', $type]])->orderBy('creat_at','desc')->paginate(10,['*'],'uPage',$page);
    }
}
